﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright company="Microsoft Corp." file="DeleteSqlAzureServerCommand.cs">
//   All rights reserved. See License.txt in the project root for license information.
// </copyright>
// 
// --------------------------------------------------------------------------------------------------------------------
namespace AzureManagement.SqlAzureCommands
{
    using System;

    using AzureManagement.AzureCommands;

    using RestClient;

    public class DeleteSqlAzureServerCommand : AzureManagementCommand
    {
        private readonly string serverName;

        public DeleteSqlAzureServerCommand(IAzureServiceContext serviceContext, string serverName)
            : base(serviceContext)
        {
            if (string.IsNullOrEmpty(serverName))
            {
                throw new ArgumentException("Server name must not be null or empty", "serverName");
            }

            this.serverName = serverName;
        }

        protected override RequestContext GetRequestContext()
        {
            return this.CreateDeleteOperationRequestContext();
        }

        protected override string FormatPath(IAzureServiceContext azureServiceContext)
        {
            return string.Format("{0}/servers/{1}", azureServiceContext.SubscriptionId, this.serverName);
        }
    }
}